<template>
  <div>
    <div class="page-title">HSE问题整改</div>
    <div class="page-content">
      <!-- 查询输入框，按钮 -->
      <el-form
        :inline="true"
        :model="filterQuery"
        @submit.native.prevent="handleSearch"
      >
        <el-row>
          <el-form-item label="检查单位">
            <treeselect
              :multiple="false"
              :options="options"
              placeholder="选择单位"
              v-model="filterQuery.companyCode"
              style="width: 220px"
            />
          </el-form-item>
          <el-form-item label="检查日期">
            <el-col :span="11">
              <el-date-picker
                type="date"
                placeholder="选择日期"
                v-model="filterQuery.startDate"
                style="width: 100%"
              ></el-date-picker>
            </el-col>
            <el-col class="line" :span="2">-</el-col>
            <el-col :span="11">
              <el-date-picker
                v-model="filterQuery.endDate"
                type="date"
                placeholder="选择日期"
              ></el-date-picker>
            </el-col> </el-form-item
          >&nbsp;&nbsp;&nbsp;
          <el-form-item>
            <el-button
              type="primary"
              @click="handleGetProblemRectify"
              native-type="submit"
              icon="el-icon-search"
              style="width: 100%"
              >查询</el-button
            >
          </el-form-item>
        </el-row>
      </el-form>

      <!-- 问题列表table -->
      <el-table :data="tableData" border ref="refTable" style="width: 100%">
        <!-- 问题列表，显示在table里面的内容 -->
        <el-table-column
          type="index"
          :index="this.indexStartNum"
          label="序号"
          width="50"
        ></el-table-column>
        <el-table-column
          label="检查时间"
          prop="audittime"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="二级单位"
          prop="parentCompanyName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="基层单位"
          prop="basicCompanyName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="作业队号"
          prop="companyName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          label="问题描述"
          prop="audDescription"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="责任人"
          prop="responsePersonName"
          header-align="center"
        >
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          header-align="center"
          width="250"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="rectifyProblem(scope.row)"
              >整改</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-dialog
        :visible.sync="entryDialogVisible"
        title="整改详情"
        style="width: 2000px; height: 800px; left: -20%; top: 0%"
      >
        <div style="height: 50vh; width: 100%; overflow: auto">
          <el-form
            :model="hseAuditProblemForm"
            ref="hseAuditProblemForm"
            label-width="100px"
            label-position="right"
            style="width: 100%"
          >
            <el-row style="padding-bottom: 5px">
              <font style="font-size: 15px; font-weight: bold">问题详情</font>
            </el-row>
            <el-row
              style="padding-top: 10px; border-top: 2px solid #dddddd"
            ></el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="组内审核：" style="width: 50%">
                  {{ hseAuditProblemForm.internalAuditorName }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核时间：" style="width: 50%">
                  {{ hseAuditProblemForm.audittime }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="受检单位：" style="width: 50%">
                  {{ hseAuditProblemForm.companyName }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="轮次：" style="width: 50%">
                  {{ hseAuditProblemForm.round }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="问题描述：">
                  {{ hseAuditProblemForm.audDescription }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="判断依据：">
                  {{ hseAuditProblemForm.judgmentBasis }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="QHSEE管理体系要素：">
                  {{ hseAuditProblemForm.qHSEEManagementFactor }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="涉及要素：" style="width: 50%">
                  {{ hseAuditProblemForm.elementsInvolved }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核主题：" style="width: 50%">
                  {{ hseAuditProblemForm.auditSubject }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审核项：">
                  {{ hseAuditProblemForm.auditItem }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="审核内容：">
                  {{ hseAuditProblemForm.auditContent }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="问题级别：" style="width: 50%">
                  {{ hseAuditProblemForm.questionLevel }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="原因分析：" style="width: 50%">
                  {{ hseAuditProblemForm.causeAnalysis }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="隐患级别：" style="width: 50%">
                  {{ hseAuditProblemForm.problemLevel }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="审核类别：" style="width: 50%">
                  {{ hseAuditProblemForm.classify }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="整改建议：">
                  {{ hseAuditProblemForm.rectificationSuggestions }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="责任人：" style="width: 50%">
                  {{ hseAuditProblemForm.responsePersonName }}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="整改责任人：" style="width: 50%">
                  {{ hseAuditProblemForm.rectPersonName }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="扣分：">
                  {{ hseAuditProblemForm.lostScore }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查图片1： ">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="hseAuditProblemForm.checkAttach1"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="hseAuditProblemForm.checkAttach1"
                        :alt="hseAuditProblemForm.checkAttach1"
                        style="max-height: 200px"
                      />
                    </el-popover>
                  </el-card>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查图片2：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-popover placement="center" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="hseAuditProblemForm.checkAttach2"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="hseAuditProblemForm.checkAttach2"
                        :alt="hseAuditProblemForm.checkAttach2"
                        style="max-height: 200px"
                      />
                    </el-popover>
                  </el-card>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查图片3：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="hseAuditProblemForm.checkAttach3"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="hseAuditProblemForm.checkAttach3"
                        :alt="hseAuditProblemForm.checkAttach3"
                        style="max-height: 200px"
                      />
                    </el-popover>
                  </el-card>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查图片4：">
                  <el-card
                    :body-style="{ padding: '10px' }"
                    style="height: 251px; width: 90%"
                  >
                    <el-popover placement="right" title="" trigger="click">
                      <div style="max-width: 600px; height: auto">
                        <img
                          :src="hseAuditProblemForm.checkAttach4"
                          style="max-width: 600px; height: auto"
                        />
                      </div>
                      <img
                        slot="reference"
                        :src="hseAuditProblemForm.checkAttach4"
                        :alt="hseAuditProblemForm.checkAttach4"
                        style="max-height: 200px"
                      />
                    </el-popover>
                  </el-card>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检查视频：">
                  <el-card
                    v-model="hseAuditProblemForm.checkVideo"
                    :show-file-list="false"
                    accept=".mp4,.qlv,.qsv,.ogg,.flv,.avi,.wmv,.rmvb"
                    :headers="{ Authorization: currentUser.token }"
                    style="height: 251px; width: 90%"
                  >
                    <video
                      v-if="
                        hseAuditProblemForm.checkVideo != '' &&
                        videoFlag1 == false
                      "
                      :src="hseAuditProblemForm.checkVideo"
                      class="avatar video-avatar"
                      controls="controls"
                    >
                      您的浏览器不支持视频播放
                    </video>
                    <i
                      v-if="
                        hseAuditProblemForm.checkVideo == '' &&
                        videoFlag1 == false
                      "
                    ></i>
                  </el-card>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <!-- 整改 -->
          <el-form
            :model="rectproblem"
            label-width="150px"
            :rules="rules"
            ref="problem"
          >
            <el-row style="padding-bottom: 5px">
              <font style="font-size: 15px; font-weight: bold">整改情况</font>
            </el-row>
            <el-row
              style="padding-top: 10px; border-top: 2px solid #dddddd"
            ></el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="评判教育：" prop="education">
                  <el-checkbox
                    v-model="rectproblem.education"
                    size="medium "
                    checked="true"
                    >勾选是否进行评判教育</el-checkbox
                  >
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="整改时间">
                  <el-input
                    size="small"
                    style="width: 80%"
                    readonly
                    v-model="rectdate"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="整改附件：">
                  图片大小不能超过12M，视频大小不能超过12M
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="整改图片1：">
                  <el-upload
                    v-model="rectproblem.rectAttach1"
                    :action="`/api/file_upload`"
                    list-type="picture"
                    :limit="1"
                    :on-remove="handleRemove1"
                    :before-upload="handleBeforeUpload"
                    :file-list="fileList1"
                    :auto-upload="true"
                    :headers="{ Authorization: currentUser.token }"
                    name="file"
                    :on-success="handleSuccess1"
                  >
                    <el-button type="success" circle
                      ><i class="el-icon-plus"></i
                    ></el-button>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="整改图片2：">
                  <el-upload
                    v-model="rectproblem.rectAttach2"
                    :action="`/api/file_upload`"
                    list-type="picture"
                    :limit="1"
                    :on-remove="handleRemove2"
                    :before-upload="handleBeforeUpload"
                    :file-list="fileList2"
                    :auto-upload="true"
                    :headers="{ Authorization: currentUser.token }"
                    name="file"
                    :on-success="handleSuccess2"
                  >
                    <el-button type="success" circle
                      ><i class="el-icon-plus"></i
                    ></el-button>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="整改图片3：">
                  <el-upload
                    v-model="rectproblem.rectAttach3"
                    :action="`/api/file_upload`"
                    list-type="picture"
                    :limit="1"
                    :on-remove="handleRemove3"
                    :before-upload="handleBeforeUpload"
                    :file-list="fileList3"
                    :auto-upload="true"
                    :headers="{ Authorization: currentUser.token }"
                    name="file"
                    :on-success="handleSuccess3"
                  >
                    <el-button type="success" circle
                      ><i class="el-icon-plus"></i
                    ></el-button>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="整改图片4：">
                  <el-upload
                    v-model="rectproblem.rectAttach4"
                    :action="`/api/file_upload`"
                    list-type="picture"
                    :limit="1"
                    :on-remove="handleRemove4"
                    :before-upload="handleBeforeUpload"
                    :file-list="fileList4"
                    :auto-upload="true"
                    :headers="{ Authorization: currentUser.token }"
                    name="file"
                    :on-success="handleSuccess4"
                  >
                    <el-button type="success" circle
                      ><i class="el-icon-plus"></i
                    ></el-button>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="视频附件：">
                  <el-upload
                    class="avatar-uploader el-upload--text"
                    v-model="rectproblem.rectVideo"
                    :action="`/api/file_upload`"
                    :file-list="videoList1"
                    :limit="1"
                    accept=".mp4,.qlv,.qsv,.ogg,.flv,.avi,.wmv,.rmvb"
                    :before-upload="beforeUploadVideo1"
                    :on-progress="uploadVideoProcess1"
                    :headers="{ Authorization: currentUser.token }"
                    :on-success="handleVideoSuccess1"
                    :on-remove="handlevideoRemove1"
                    style="width: 100%"
                  >
                    <video
                      v-if="rectproblem.rectVideo != '' && videoFlag1 == false"
                      :src="rectVideourl"
                      class="avatar video-avatar"
                      controls="controls"
                    >
                      您的浏览器不支持视频播放
                    </video>
                    <i
                      v-if="rectproblem.rectVideo == '' && videoFlag1 == false"
                      class="el-icon-plus avatar-uploader-icon"
                    ></i>
                    <el-progress
                      v-if="videoFlag1 == true"
                      type="circle"
                      :percentage="videoUploadPercent1"
                      style="margin-top: 30px"
                    ></el-progress>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="相关文件：">
                  <el-upload
                    v-model="rectproblem.rectFile"
                    class="upload-demo"
                    :action="`/api/file_upload`"
                    :on-preview="handlePreview"
                    :on-remove="handleRemove"
                    :on-success="handlefileSuccess"
                    :before-remove="beforeRemove"
                    multiple
                    :limit="1"
                    :on-exceed="handleExceed"
                    :headers="{ Authorization: currentUser.token }"
                    :file-list="fileList"
                  >
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">
                      上传整改相关文件
                    </div>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-form-item label="整改描述：" prop="rectDescription">
                <el-input
                  v-model="rectproblem.rectDescription"
                  style="width: 100%"
                  type="textarea"
                  :autosize="{ minRows: 4 }"
                ></el-input>
              </el-form-item>
            </el-row>
          </el-form>
        </div>
        <span slot="footer">
          <el-button @click="entryDialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="rectifySucceedPerson('rectproblem')"
            >整改</el-button
          >
        </span>
      </el-dialog>
      <div class="pagination-base">
        <el-pagination
          @current-change="handlePageChange"
          :current-page="filterQuery.pageIdx"
          :page-size="filterQuery.pageSize"
          :total="total"
          background
          layout="total, prev, pager, next, jumper"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import { getRectifyPerson, UpdateRect } from "../../../services/rectifyProblem";
import { GetCurrentUser } from "../../../store/CurrentUser";
import { GetCQCompany } from "../../../services/gettreedata";
import { UploadURL } from "../../../services/hseAudit";
import Vue from "vue";
import VueCookies from "vue-cookies";
Vue.use(VueCookies);

export default {
  data() {
    return {
      rules: {},
      dialogImageUrl: "",
      dialogVisible: false,
      checkAttachFileList: [],
      videoFlag1: false,
      education: true,
      rectproblem: {
        qHSEECheckRecordID: "",
        lostScore: "",
        penalty: "",
        rectification: "",
        rectAttach1: "",
        rectAttach2: "",
        rectAttach3: "",
        rectAttach4: "",
        rectVideo: "",
        rectDescription: "",
        rectFile: "",
        rectDate: "",
        RectPersonID: "",
        RectPersonName: "",
        checkrecordID: "",
        education: true,
        status: "未整改",
      },
      hseAuditProblemForm: {
        checkerName: "",
        audittime: "",
        auditContent: "",
        companyName: "",
        checkAttach1: "",
        checkAttach2: "",
        checkAttach3: "",
        checkAttach4: "",
        checkVideo: "",
        qHSEECheckRecordID: "",
        internalAuditorID: "",
        internalAuditorName: "",
        companyCode: "",
        round: "",
        audDescription: "",
        judgmentBasis: "",
        qHSEEManagementFactor: "",
        elementsInvolved: "",
        auditSubject: "",
        auditItem: "",
        questionLevel: "",
        causeAnalysis: "",
        dialogVisible: false,
        problemLevel: "",
        classify: "",
        rectificationSuggestions: "",
        lostScore: "",
        responsePersonID: "",
        responsePersonName: "",
        rectPersonID: "",
        rectPersonName: "",
        scoringItem: "",
        penalty: "",
      },
      // hseAuditProblemFormRules: {
      //   internalAuditorName: [
      //     { required: true, message: "请选择组内审核人", trigger: "change" },
      //   ],
      // },
      formLabelWidth: "120px",
      showDialog: false,
      entryDialogVisible: false,
      dataToDialog: {},
      indexStartNum: 1,
      client: VueCookies.get("client"),
      dateRange: [], //选择时间
      options: [], //选择单位
      audit: {},
      filterQuery: {
        startDate: "",
        endDate: "",
        companyCode: null,
        pageIdx: 0,
        pageSize: 10,
      },
      filterQueryExcel: {},
      fitertask: {},
      total: 0,
      checkAttachLabel: `问题图片：\n最多上传四\n张图片，且\n每一张大小\n不超过12M!`,
      employees: [],
      tableData: [],
      problemAyy: "",
      timeout: null,
      excelData: [],
      levelData: [],
      problemCause: [],
      companyData: [],
      dangerLevel: [],
      problemLevel: [],
      checkType: [],
      fileList: [], //附件列表
      fileList1: [], //图片附件1
      fileList2: [], //图片附件2
      fileList3: [], //图片附件3
      fileList4: [], //图片附件4
      videoList1: [],
      //获取整改时间
      rectdate: "",
    };
  },

  mounted() {
    this.getDate(); // 获取公司列表
    this.handleGetProblemRectify();
  },
  computed: {
    currentUser() {
      return GetCurrentUser();
    },
  },
  methods: {
    //上传图片之前
    handleBeforeUpload(file) {
      const isJPG =
        file.type === "image/png" ||
        file.type === "image/gif" ||
        file.type === "image/jpg" ||
        file.type === "image/jpeg";
      const isLt5M = file.size / 1024 / 1024 < 12;
      if (!isJPG) {
        this.$message.error("请检查图片格式!");
      }
      if (!isLt5M) {
        this.$message.error("上传图片大小不能超过 12MB!");
      }
      return isJPG && isLt5M;
    },
    //上传视频
    beforeUploadVideo1(file) {
      //视频上传之前判断他的大小
      const isLt50M = file.size / 1024 / 1024 < 50;
      if (!isLt50M) {
        this.$message.error("上传视频大小不能超过50MB哦!");
        return false;
      }
      this.isShowUploadVideo1 = false;
    },
    //上传文件
    handleRemove(file, fileList) {
      this.rectproblem.rectFile = "";
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(/**files, fileList*/) {
      this.$message.warning(`当前限制选择 1 个文件`);
    },
    handlefileSuccess(response) {
      this.rectproblem.rectFile = response.data;
      //console.log(this.fileList);
    },
    beforeRemove(file /**, fileList*/) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    handlevideoRemove1(file, videoList1) {
      this.rectproblem.rectVideo = "";
      console.log(file, videoList1);
    },
    handleVideoSuccess1(res) {
      //视频上传成功之后返回视频地址
      this.isShowUploadVideo1 = true;
      this.videoFlag1 = false;
      this.videoUploadPercent1 = 0;
      this.rectproblem.rectVideo = res.data;
      this.rectVideourl =
        "http://39.98.173.131:8080/resources/" + this.rectproblem.rectVideo;
    },
    uploadVideoProcess1(event, file) {
      //视频上传的时候获取上传进度传给进度条
      this.videoFlag1 = true;
      this.videoUploadPercent1 = parseInt(file.percentage);
      // console.log(this.videoUploadPercent)
    },
    // 上传图片
    handleRemove1(file, fileList1) {
      this.rectproblem.rectAttach1 = null;
      console.log(file, fileList1);
    },
    handleRemove2(file, fileList2) {
      this.rectproblem.rectAttach2 = null;
      console.log(file, fileList2);
    },
    handleRemove3(file, fileList3) {
      this.rectproblem.rectAttach3 = null;
      console.log(file, fileList3);
    },
    handleRemove4(file, fileList4) {
      this.rectproblem.rectAttach4 = null;
      console.log(file, fileList4);
    },
    handleSuccess1(response) {
      console.log(response);
      this.rectproblem.rectAttach1 = UploadURL + response.data;
    },
    handleSuccess2(response) {
      console.log(response);
      this.rectproblem.rectAttach2 = UploadURL + response.data;
    },
    handleSuccess3(response) {
      console.log(response);
      this.rectproblem.rectAttach3 = UploadURL + response.data;
    },
    handleSuccess4(response) {
      console.log(response);
      this.rectproblem.rectAttach4 = UploadURL + response.data;
    },
    handlePageChange(page) {
      this.filterQuery.pageIdx = page;
      this.handleGetProblemRectify();
    },
    //获取公司
    getDate() {
      GetCQCompany()
        .then((res) => {
          this.options = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    // 查询
    handleGetProblemRectify() {
      let filterQuery = {
        startDate: this.filterQuery.startDate || "",
        endDate: this.filterQuery.endDate || "",
        companyCode: this.filterQuery.companyCode || "",
        num: this.filterQuery.pageIdx,
        size: this.filterQuery.pageSize,
      };
      console.log("w", filterQuery);
      getRectifyPerson(filterQuery).then((res) => {
        console.log("e", res.data);
        this.indexStartNum =
          this.filterQuery.pageIdx * this.filterQuery.pageSize + 1;
        this.tableData = res.data.list;
        this.total = res.data.total;
      });
    },
    // 整改
    rectifyProblem(row) {
      //获取整改时间
      var today = new Date();
      var dd = String(today.getDate()).padStart(2, "0");
      var mm = String(today.getMonth() + 1).padStart(2, "0");
      var yyyy = today.getFullYear();
      today = yyyy + "-" + mm + "-" + dd;
      this.rectdate = today;
      console.log(this.rectdate);
      for (const key in this.hseAuditProblemForm) {
        if (Object.hasOwnProperty.call(this.hseAuditProblemForm, key)) {
          this.hseAuditProblemForm[key] = row[key];
        }
      }
      this.entryDialogVisible = true;
      const {
        qHSEECheckRecordID,
        penalty,
        education,
        rectification,
        rectFile,
        rectDate,
        RectPersonID,
        RectPersonName,
      } = row;
      this.rectproblem.qHSEECheckRecordID = qHSEECheckRecordID;
      this.rectproblem.penalty = penalty;
      this.rectproblem.education = education || false;
      this.rectproblem.rectification = rectification;
      this.rectproblem.rectFile = rectFile;
      this.rectproblem.rectDate = rectDate;
      this.rectproblem.RectPersonID = RectPersonID;
      this.rectproblem.RectPersonName = RectPersonName;
    },
    rectifySucceedPerson(problem) {
      console.log(11, problem);
      console.log("u", this.$refs["problem"]);
      this.$refs["problem"].validate((valid) => {
        if (valid) {
          console.log("1", this.rectproblem.education);
          console.log(2, this.rectproblem);
          this.rectproblem.rectDate = this.rectdate;
          console.log(this.rectproblem.rectDate);
          UpdateRect(this.rectproblem).then(
            (res) => {
              console.log(111, res);
                
                if(res.code==1000){
                  this.entryDialogVisible = false;
                  this.$router.go(0);
                  this.$message.success("操作成功!");
                }
                
                this.$refs[problem].resetFields();
                this.handleGetProblemRectify();
            },
            (err) => {
              this.$message.error(err.message);
              this.entryDialogVisible = false;
            }
          );
          // this.$router.go(0);
        } else {
          this.$notify.warning({
            title: "温馨提示",
            message: "请检查必填项",
          });
          return false;
        }
      });
      // this.$router.go(0);
    },

    
  },
};
</script>
<style media="screen">
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  /* width: 49%; */
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  /* width: 49%; */
}
/*分辨率低于1280，采用下面的样式*/
@media screen and (max-device-width: 1280px) {
  .outDiv {
    width: 1060px;
  }
}
/*分辨率高于1280，采用下面的样式*/
@media screen and (min-device-width: 1281px) {
  .outDiv {
    width: 100%;
  }
}
</style>
